using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Newtonsoft.Json.Linq;

namespace ns19
{
	internal class Class80 : Collection<JToken>
	{
		private static readonly IEqualityComparer<string> iequalityComparer_0 = StringComparer.Ordinal;

		private Dictionary<string, JToken> dictionary_0;

		public JToken this[string key]
		{
			get
			{
				if (key == null)
				{
					throw new ArgumentNullException("key");
				}
				if (dictionary_0 == null)
				{
					throw new KeyNotFoundException();
				}
				return dictionary_0[key];
			}
		}

		public ICollection<string> ICollection_0
		{
			get
			{
				method_4();
				return dictionary_0.Keys;
			}
		}

		public ICollection<JToken> ICollection_1
		{
			get
			{
				method_4();
				return dictionary_0.Values;
			}
		}

		private void method_0(string string_0, JToken jtoken_0)
		{
			method_4();
			dictionary_0[string_0] = jtoken_0;
		}

		protected void method_1(JToken jtoken_0, string string_0)
		{
			if (!method_3(jtoken_0))
			{
				throw new ArgumentException("The specified item does not exist in this KeyedCollection.");
			}
			string text = method_5(jtoken_0);
			if (!iequalityComparer_0.Equals(text, string_0))
			{
				if (string_0 != null)
				{
					method_0(string_0, jtoken_0);
				}
				if (text != null)
				{
					method_7(text);
				}
			}
		}

		protected virtual void ClearItems()
		{
			base.ClearItems();
			if (dictionary_0 != null)
			{
				dictionary_0.Clear();
			}
		}

		public bool method_2(string string_0)
		{
			if (string_0 == null)
			{
				throw new ArgumentNullException("key");
			}
			if (dictionary_0 != null)
			{
				return dictionary_0.ContainsKey(string_0);
			}
			return false;
		}

		private bool method_3(JToken jtoken_0)
		{
			if (dictionary_0 == null)
			{
				return false;
			}
			string key = method_5(jtoken_0);
			JToken value;
			return dictionary_0.TryGetValue(key, out value);
		}

		private void method_4()
		{
			if (dictionary_0 == null)
			{
				dictionary_0 = new Dictionary<string, JToken>(iequalityComparer_0);
			}
		}

		private string method_5(JToken jtoken_0)
		{
			return ((JProperty)jtoken_0).Name;
		}

		protected virtual void InsertItem(int index, JToken item)
		{
			method_0(method_5(item), item);
			base.InsertItem(index, item);
		}

		public bool method_6(string string_0)
		{
			if (string_0 == null)
			{
				throw new ArgumentNullException("key");
			}
			if (dictionary_0 != null)
			{
				if (dictionary_0.ContainsKey(string_0))
				{
					return Remove(dictionary_0[string_0]);
				}
				return false;
			}
			return false;
		}

		protected virtual void RemoveItem(int index)
		{
			string string_ = method_5(base.Items[index]);
			method_7(string_);
			base.RemoveItem(index);
		}

		private void method_7(string string_0)
		{
			if (dictionary_0 != null)
			{
				dictionary_0.Remove(string_0);
			}
		}

		protected virtual void SetItem(int index, JToken item)
		{
			string text = method_5(item);
			string text2 = method_5(base.Items[index]);
			if (iequalityComparer_0.Equals(text2, text))
			{
				if (dictionary_0 != null)
				{
					dictionary_0[text] = item;
				}
			}
			else
			{
				method_0(text, item);
				if (text2 != null)
				{
					method_7(text2);
				}
			}
			base.SetItem(index, item);
		}

		public bool method_8(string string_0, out JToken jtoken_0)
		{
			if (dictionary_0 == null)
			{
				jtoken_0 = null;
				return false;
			}
			return dictionary_0.TryGetValue(string_0, out jtoken_0);
		}

		public bool method_9(Class80 class80_0)
		{
			if (this == class80_0)
			{
				return true;
			}
			Dictionary<string, JToken> dictionary = dictionary_0;
			Dictionary<string, JToken> dictionary2 = class80_0.dictionary_0;
			if (dictionary == null && dictionary2 == null)
			{
				return true;
			}
			if (dictionary == null)
			{
				return dictionary2.Count == 0;
			}
			if (dictionary2 == null)
			{
				return dictionary.Count == 0;
			}
			if (dictionary.Count != dictionary2.Count)
			{
				return false;
			}
			foreach (KeyValuePair<string, JToken> item in dictionary)
			{
				if (dictionary2.TryGetValue(item.Key, out var value))
				{
					JProperty jProperty = (JProperty)item.Value;
					JProperty jProperty2 = (JProperty)value;
					if (!jProperty.Value.Newtonsoft_002EJson_002ELinq_002EJToken_002E_206F_200C_206F_206F_206B_200E_206C_206B_200C_200D_202E_200E_200E_200D_202C_200D_200C_206B_200F_202D_202E_200F_200C_202D_206B_200D_206B_206E_202E_206E_202B_206D_206E_206F_202C_202E_200D_200C_200D_200F_202E(jProperty2.Value))
					{
						return false;
					}
					continue;
				}
				return false;
			}
			return true;
		}
	}
}
